﻿using Fabrication.Tests.TestClasses;
using NUnit.Framework;

namespace Fabrication.Tests
{
    [TestFixture]
    public class inherited_properties
    {
        [Test]
        public void should_populate_properties_inherited_from_base_class()
        {
            var builtItem = new FabricationScope().Generate<DerivedClass>();

            Assert.That(builtItem.BaseClassProperty, Is.EqualTo("BaseClassProperty1"));
            Assert.That(builtItem.DerivedClassProperty, Is.EqualTo("DerivedClassProperty1"));
        }

        [Test]
        public void should_handle_linking_to_base_class_properties()
        {
            var builtItem = new FabricationScope().Setup<DerivedClass>()
                .Link(x => x.DerivedClassProperty).To(x => x.BaseClassProperty)
                .Generate();

            Assert.That(builtItem.DerivedClassProperty, Is.EqualTo(builtItem.BaseClassProperty));
        }
    }
}
